package com.example;

import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;

/**
 * <pre>
 *      demo-study-spring-boot
 * </pre>
 *
 * @author tao
 * @version v1.0.0
 * @since 2021/11/17 13:36
 */
public class Test {

    public static void main(String[] args) {
        LocalDate yearStart = LocalDate.now().with(TemporalAdjusters.firstDayOfYear()).atStartOfDay(ZoneId.systemDefault()).toLocalDate();
        for(int i = 0; i < 12; i++){
            String startTime = DateUtil.localDate2Str(yearStart, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            yearStart = yearStart.plusMonths(1);
            String endTime = DateUtil.localDate2Str(yearStart, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            System.out.println(startTime + ":" + endTime);
        }
    }
}
